import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { ObjCreate } from "../../common/ObjCreate";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { MountStartsTargetToolTipsData } from "./MountStartsTargetToolTipsData";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
import { NormalTooltip } from "../../common/tooltip/NormalTooltip";
import { ItemData } from "../../../resource/info/ItemData";
import { EColor } from "../../../../../Message/Public/EColor";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
type int = number;
//class MountStartsTargetSp
    
    export  class MountStartsTargetSp /* flash.display.Sprite */ implements IToolTipItem
    {
        constructor()
        {
            
            this.initView();
            this.useHandCursor = true;
            this.buttonMode = true;
            this.addEventListener(flash.events.MouseEvent.MOUSE_OVER, this.onThisOver);
            return;
        }

        protected onThisOver(arg1: Object /* flash.events.MouseEvent */): void
        {
            return;
        }

        /* internal  */initView(): void
        {
            this._bm = ObjCreate.createBitmap("", 0, 0, this);
            LoaderHelp.addResCallBack(ResFileConst.mountStarts, this.onLoadBmResource);
            this._toolTipsData = new MountStartsTargetToolTipsData();
            return;
        }

        /* internal  */onLoadBmResource(): void
        {
            this._loaded = true;
            this.changeBm();
            return;
        }

        public updateSeleted(arg1: int): void
        {
            var loc1=null;
            this._startsLv = arg1 + 1;
            if (this._mountIdata) 
            {
                this._targetLv = this._mountIdata.itemExInfo.m_stTa[arg1];
                if (this._loaded) 
                {
                    this.changeBm();
                }
                this._toolTipsData.curStartsLv = arg1;
                this._toolTipsData.mountIData = this._mountIdata;
                loc1 = new ToolTipInfo(NormalTooltip.ToolTipRenderType_MountStartsTarget, this._toolTipsData);
                this.toolTipData = loc1;
            }
            return;
        }

        public updateInfo(arg1: ItemData): void
        {
            this._mountIdata = arg1;
            return;
        }

        /* internal  */changeBm(): void
        {
            if (this._targetLv <= EColor._EColorBlue) 
            {
                this._bm.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountStartsTargetBlue);
                if (this._targetLv < EColor._EColorBlue) 
                {
                    this._bm.filters = [FilterConst.colorFilter];
                }
                else 
                {
                    this._bm.filters = [];
                }
            }
            else if (this._targetLv != EColor._EColorPurple) 
            {
                if (this._targetLv != EColor._EColorOrange) 
                {
                    this._bm.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountStartsTargetGold);
                    this._bm.filters = [];
                }
                else 
                {
                    this._bm.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountStartsTargetOrange);
                    this._bm.filters = [];
                }
            }
            else 
            {
                this._bm.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountStartsTargetPurple);
                this._bm.filters = [];
            }
            return;
        }

        public get toolTipData()
        {
            return this._tooltipData;
        }

        public set toolTipData(arg1)
        {
            if (arg1 == null || arg1 == "") 
            {
                ToolTipsManager.unregister(this);
            }
            else 
            {
                ToolTipsManager.register(this);
            }
            this._tooltipData = arg1;
            return;
        }

        /* internal */ /* var */_bm: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_loaded: Boolean;

        /* internal */ /* var */_startsLv: int;

        /* internal */ /* var */_mountIdata: ItemData;

        /* internal */ /* var */_targetLv: int;

        /* internal */ /* var */_toolTipsData: MountStartsTargetToolTipsData;

        /* internal */ /* var */_tooltipData;
    }
